Skip to content

Organize JSON schema output by protocol category#90

Merged
hotlong merged 3 commits intomainfrom
copilot/build-json-schema-by-category
Jan 23, 2026
Merged

Organize JSON schema output by protocol category#90
hotlong merged 3 commits intomainfrom
copilot/build-json-schema-by-category

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 23, 2026

With 325+ schemas in a flat directory, navigation was becoming unwieldy. JSON schema generation now mirrors the source protocol structure.

Changes

  • Build script (scripts/build-schemas.ts): Generates schemas into category subdirectories matching namespace organization
  • Directory structure: json-schema/{data,ui,system,ai,api}/ instead of flat 325-file directory
  • Documentation: Added json-schema/README.md with category breakdown and usage patterns

Schema Distribution

data/    74 schemas  (Business Logic & Data Modeling)
ui/      39 schemas  (Presentation & Interaction)
system/ 112 schemas  (Runtime Configuration & Security)
ai/      86 schemas  (AI/ML Capabilities)
api/     12 schemas  (API Contracts & Envelopes)

The package.json files array already includes json-schema/, so subdirectories are automatically included in published packages.

Original prompt

协议越来越多,json schema是不是也应该按分类 build 生成


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
spec Ready Ready Preview, Comment Jan 23, 2026 3:55pm

Request Review

Copilot AI and others added 2 commits January 23, 2026 15:52
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@hotlong hotlong marked this pull request as ready for review January 23, 2026 15:53
Copilot AI review requested due to automatic review settings January 23, 2026 15:53
@github-actions github-actions bot added documentation Improvements or additions to documentation tooling size/xl labels Jan 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR is very large. Consider breaking it into smaller PRs for easier review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reorganizes the JSON schema generation to output schemas into category-specific subdirectories (data/, ui/, system/, ai/, api/) instead of a flat directory structure, making the 325+ schemas easier to navigate and understand as the protocol continues to grow.

Changes:

  • Modified build script to generate schemas organized by protocol namespace/category
  • Created comprehensive README documentation for the json-schema directory
  • Migrated all JSON schemas from flat structure to categorized subdirectories

Reviewed changes

Copilot reviewed 4 out of 328 changed files in this pull request and generated 2 comments.

File Description
json-schema/README.md Added comprehensive documentation explaining the new categorized structure, usage examples, and conventions
json-schema/MenuItem.json Removed from flat directory (moved to appropriate category subdirectory)
json-schema/AuthenticationProvider.json Removed from flat directory (moved to system/ subdirectory)
json-schema/AuthenticationConfig.json Removed from flat directory (moved to system/ subdirectory)

Comment on lines +80 to +81
```typescript
import fieldSchema from '@objectstack/spec/json-schema/data/Field.json';
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TypeScript import example shows importing from '@objectstack/spec' but doesn't clarify the actual package structure. If this package publishes the json-schema directory at the package root, the import path should be verified. Consider adding a note about how the package exports these schemas or whether users should use relative paths.

Suggested change
```typescript
import fieldSchema from '@objectstack/spec/json-schema/data/Field.json';
```typescript
// If your bundler/runtime supports JSON imports and the package publishes
// the `json-schema` directory at the package root:
import fieldSchema from '@objectstack/spec/json-schema/data/Field.json';
// Or, if you are working within this repository or have the schemas copied
// locally, you can use a relative path instead:
// import fieldSchema from '../json-schema/data/Field.json';

Copilot uses AI. Check for mistakes.

```json
{
"$schema": "./node_modules/@objectstack/spec/json-schema/data/Object.json"
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IDE example uses a relative path through node_modules which may not work correctly for all IDEs or project structures. Consider adding an alternative example using a $schema reference that works with published packages or providing guidance on when to use relative vs package-based paths.

Copilot uses AI. Check for mistakes.
Copilot AI changed the title [WIP] Add support for categorizing JSON schemas Organize JSON schema output by protocol category Jan 23, 2026
Copilot AI requested a review from hotlong January 23, 2026 15:56
@hotlong hotlong merged commit 080701a into main Jan 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants